<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>

<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <title>报价密码管理（生产企业端）</title>
    <%@ include file="/WEB-INF/component/commonCSS.jsp" %> 
    <!--[if lt IE 9]>
        <script src="lib/js/html5shiv.min.js"></script>
        <script src="lib/js/respond.min.js"></script>
    <![endif]-->
</head>
<body class="skin-blue-light sidebar-mini fixed skin-blue-light-frame">

    <section class="content-header">
        <h1>报价密码管理</h1>
        <ol class="breadcrumb">
            <li><a href="${ctx}/home.jsp"><i class="fa fa-home"></i>首页</a></li>
            <li class="active"><a href="#">药品招标管理</a></li>
            <li class="active"><a href="#">采购项目管理</a></li>
            <li class="active"><a href="#">报价密码管理</a></li>
        </ol>
    </section>
    <section class="content">
        <div class=" box box-success">
            <div class="box-body">
                <div class=" form-inline">
                     <div class="form-group form-group-xs">
                        <label>项目名称：</label>
                        <select class="form-control" style="width:220px;" id="projId" name="projId"></select>
                    </div>
                     
                    <button type="button" onclick="gridSerch();" class="btn btn-success btn-sm"> 查&nbsp;询</button>
                </div>
            </div>
        </div>
        <table class="jqgrid" id="gridlist"></table>
          <div class=" box box-warning bottongroup"></div>
        

    </section>
    <%@ include file="/WEB-INF/component/commonJS.jsp" %> 
    <script type="text/javascript">
        
        $(function () {
            $("#gridlist").jqGrid({
                url: "${ctx}/prodProject/getProjectListPassword.html",
                mtype: "POST",
                datatype: "json",
                autowidth: true,
                height: 270,
                colNames: [ '操作','projId','项目名称','采购开始日期', '采购结束日期','报价开始时间','报价结束时间','报价解密开始时间','报价解密结束时间','状态'],
                colModel: [
                    { name: 'operate', width: 30 , align:"center" ,sortable: false, 
                        formatter : function(val, opts, rowdata) {
                        	if ( rowdata.endtime!=null && rowdata.endtime!="" && "${date}" <= rowdata.endtime) {
                        		if(rowdata.priceKey){
                        			return "<a href='javascript:passwordManagement(\""+rowdata.projId+"\",\""+rowdata.name+"\");' >修改</a>";
                        		}else{
                        			return "<a href='javascript:passwordManagement(\""+rowdata.projId+"\",\""+rowdata.name+"\");' >设置</a>";
                        		}
                            }
                            return "";
                        }
                    },
                    { name: 'projId', width: 120 ,hidden:true, align:"center",sortable: false},
                    { name: 'name', width: 140 , align:"left",sortable: false},
                    { name: 'starttime', width: 60 , align:"center" ,sortable: false},
                    { name: 'endtime', width: 60 , align:"center" ,sortable: false},
                    { name: 'priceQuoteStarttime', width: 100, align: 'center' ,sortable: false},
                    { name: 'priceQuoteEndtime', width: 100, align: 'center' ,sortable: false},
                    { name: 'priceQuoteDecodeStarttime', width: 100, align: 'center' ,sortable: false},
                    { name: 'priceQuoteDecodeEndtime', width: 100, align: 'center' ,sortable: false},
                    { name: 'status', width: 60, align: 'center' ,sortable: false,
						formatter : function(val, opts,rowdata) {
							if (val == 1) {
								return "启用";
							} else if (val == 0) {
								return "停用";
							}
					}}
             
                ],
                rowNum: 0,
                rownumbers: true,
                pager: "#gridpage",
                //multiselect: true, 
                viewrecords: true,
                caption: "采购项目列表",
                jsonReader: {
                    repeatitems: false,
                    id: "projId"
                },
                loadComplete: function (data) { //完成服务器请求后，回调函数
               	 formatSelect("#projId",data.rows);
               }
            });
            $("#gridlist").jqGrid('navGrid', '#gridpage', { add: false, edit: false, del: false, search: false, refresh: false });
            $(window).trigger("resize");  
            
        });
        

        //查询
        function gridSerch() {
            var projId = $("#projId").val();
            $("#gridlist").jqGrid('setGridParam',{  
                datatype:'json',
                postData:{"projId":projId
                        }
            }).trigger("reloadGrid"); //重新载入  
        }
        
        
        
       function passwordManagement(projId,name){
            $.HN.dialog.open({
                id:"passwordManagement",
                title:name,
                url:" ${ctx}/prodProject/toPasswordSet.html?projId="+projId,
                data:{"interflowId":projId},
                width:"800px",
                height:"320px"
            });
        }
 
    </script>
</body>
</html>